<template>
  <div class="ReviewList" v-if="choiceness">
    <div class="Reviewtop">
      <div class="backtrack iconfont icon-fanhui" @click="previous"></div>
      <div class="consst">
        <div class="img">
          <img :src="choiceness.user.avatar + '?param=140y140'" alt="" />
        </div>
        <div class="nests">{{ choiceness.user.username }}</div>
      </div>
      <div class="attention">+关注</div>
      <div class="share iconfont icon-share-s" @click="showShare = true">
        <van-share-sheet
          v-model="showShare"
          :options="options"
          @select="onSelect"
          @click="cancel"
        />
      </div>
    </div>
    <!-- 横线 -->
    <div class="transverse"></div>
    <!--  -->
    <div class="imglist">
      <ul>
        <li class="img" v-for="item in choiceness.images" :key="item.id">
          <img :src="item + '?param=140y140'" />
        </li>
      </ul>
    </div>
    <!--  -->
    <div class="message">
      <div class="p1">{{ choiceness.title }}</div>
      <div class="p2">
        {{ choiceness.content }}
      </div>
      <div class="timw">4小时前</div>
    </div>
    <div class="transverses"></div>
    <!-- 评论区 -->
    <div class="Commentslists">
      <p class="p0">共{{ commentnewlen }}条评论</p>
      <!-- 评论 -->
      <ul>
        <li v-for="item in commentnew" :key="item.id">
          <div class="img">
            <img :src="item.userDetail.avatar_big" alt="" />
          </div>
          <div class="list">
            <div class="one">
              <span>{{ item.userDetail.nickname }}</span>
              <div class="iconfont icon-dianzan"></div>
            </div>
            <p>{{ item.contentText }}</p>
            <div class="inferior">
              <div class="times">07-14</div>
            </div>
          </div>
        </li>
      </ul>
    </div>
    <div class="hint" v-show="!commentnewlen == 0">暂时没有更多了</div>
    <div class="hint" v-show="commentnewlen == 0">还有没人评论</div>
    <!-- 分享 -->
    <div class="cancel" v-if="showShare" @click="showShare = false"></div>
  </div>
</template>

<script>
import { Toast } from "vant";
import { getcommentnew, getnote } from "../api/home";
export default {
  data() {
    return {
      commentnew: "",
      commentnewlen: "",
      lists: "",
      choiceness: "",
      showShare: false,
      cancel: true,
      options: [
        [
          { name: "微信", icon: "wechat" },
          { name: "朋友圈", icon: "wechat-moments" },
          { name: "微博", icon: "weibo" },
          { name: "QQ", icon: "qq" },
        ],
        [
          { name: "复制链接", icon: "link" },
          { name: "分享海报", icon: "poster" },
          { name: "二维码", icon: "qrcode" },
          { name: "小程序码", icon: "weapp-qrcode" },
        ],
      ],
    };
  },
  methods: {
    //手记手记内容详情
    getnoteFun() {
      let noteId = this.$route.query.id;
      getnote({ noteId: noteId }).then((data) => {
        console.log("精选列表", data);
        this.choiceness = data.data;
      });
    },
    //评论
    getcommentsFun() {
      let noteId = this.$route.query.id;
      getcommentnew({ noteId: noteId }).then((data) => {
        // console.log("手记评论列表1111111", data);
        this.commentnew = data.data;
        this.commentnewlen = data.data.length;
      });
    },
    //分享
    onSelect(option) {
      Toast(option.name);
      this.showShare = false;
    },
    //返回上一层
    previous() {
      this.$router.go(-1);
    },
  },

  mounted() {
    this.getcommentsFun();
    this.getnoteFun();
  },
};
</script>

<style lang="less" >
.ReviewList {
  width: 100%;
  .Reviewtop {
    position: fixed;
    top: 0px;
    left: 0px;
    background-color: #fff;
    width: 100%;
    display: flex;
    .backtrack {
      width: 43px;
      height: 43px;
      line-height: 43px;
      text-align: center;
      font-size: 20px;
      margin-left: 10px;
      font-weight: 600;
    }
    .consst {
      width: 100%;
      height: 43px;
      line-height: 43px;
      display: flex;
      .img {
        width: 22px;
        height: 22px;
        margin: auto 10px;
        img {
          width: 22px;
          height: 22px;
          border-radius: 50%;
        }
      }
      .nests {
        font-size: 13px;
        height: 43px;
        line-height: 43px;
      }
    }
    .attention {
      width: 50px;
      height: 22px;
      line-height: 22px;
      border-radius: 18px;
      margin-top: 8px;
      border: 1px solid #ed766a;
      color: #ed766a;
      font-size: 12px;
      margin-right: 20px;
      padding: 1px 7px 1px 7px;
    }
    .share {
      font-size: 14px;
      height: 43px;
      line-height: 43px;
      margin-right: 10px;
      font-weight: 600;
    }
  }
  .transverse {
    width: 100%;
    height: 2px;
    background-color: #eeeeee;
    margin-top: 43px;
  }
  .transverses {
    width: 100%;
    height: 2px;
    background-color: #eeeeee;
  }
  .imglist {
    width: 96%;
    margin: 0 auto;
    ul {
      margin-top: 12px;
      display: flex;
      flex-wrap: wrap;
      .img {
        width: 112px;
        height: 112px;
        margin: 3px;
        img {
          width: 112px;
          height: 112px;
          border-radius: 8px;
        }
      }
    }
  }
  .message {
    .p1 {
      font-size: 16px;
      font-weight: 600;
      padding: 13px 13px 6px 13px;
    }
    .p2 {
      font-size: 13px;
      padding: 0px 13px;
      margin-bottom: 5px;
    }
    .timw {
      font-size: 12px;
      color: #87909f;
      padding-left: 13px;
      margin-top: 10px;
      margin-bottom: 12px;
    }
  }
  .Commentslists {
    width: 100%;
    .p0 {
      font-size: 13px;
      margin: 14px 12px 14px 12px;
    }
    ul {
      display: flex;
      flex-direction: column;
      margin-top: 5px;
      width: 100%;
      li {
        display: flex;
        margin-top: 14px;
        width: 100%;
        .img {
          width: 33px;
          height: 33px;
          margin-left: 18px;
          margin-right: 12px;
          border-radius: 50%;
          border: 1px solid #f6f6f6;
          img {
            width: 33px;
            height: 33px;
            border-radius: 50%;
            background-color: #acacac;
          }
        }
        .list {
          display: flex;
          flex: 1;
          flex-direction: column;
          .one {
            display: flex;
            width: 100%;
            justify-content: space-between;
            span {
              height: 12px;
              margin-top: 3px;
              line-height: 12px;
              font-size: 12px;
              color: #7c7c7c;
            }
            .iconfont {
              margin-right: 18px;
            }
          }
          p {
            width: 90%;
            margin-top: 4px;
            line-height: 20px;
            font-size: 13px;
          }
          .inferior {
            display: flex;
            height: 14px;
            line-height: 14px;
            justify-content: space-between;
            margin-top: 10px;
            border-bottom: 2px solid #fafafa;
            padding-bottom: 10px;
            .times {
              color: #a0a0a0;
              font-size: 12px;
            }
            .give {
              display: flex;
              margin-right: 22px;
              .iconfont {
                margin-left: 18px;
                font-size: 14px;
              }
            }
          }
        }
      }
    }
  }
  .hint {
    height: 50px;
    line-height: 50px;
    font-size: 12px;
    color: #87909f;
    text-align: center;
  }
  // 分享遮罩层
  .cancel {
    z-index: 2053;
    position: fixed;
    height: 56%;
    width: 100%;
    // background-color: red;
    top: 0px;
    left: 0px;
  }
}
</style>